package kr.or.kead.ui.list.model;

import kr.or.kead.domain.Professor;
import kr.or.kead.service.DaoProfessor;
import kr.or.kead.service.DaoTable;
import kr.or.kead.service.Daodepart;

public class DepartCustomTableModel extends AbsCustomTableModel {
	private DaoTable daoDepart;
	
	public DepartCustomTableModel() {
		sql = "select code '코드', name '학과명', prof '교수명',  tel '연락처' from depart";
		getResultSet();
		daoDepart = new Daodepart();
	}
	@Override
	public Object getValueAt(int row, int col) {
		DaoProfessor daoprof = new DaoProfessor();
		Object[] depart = arData.get(row);
		switch(col){
		case 0: case 1: return depart[col];
		case 2: Professor professor= (Professor) daoprof.selectTableById((int)depart[col]);
			return professor.getName();
		case 3: return depart[col];
		}
		return null;
	}

}
